import { POST } from '@/server/index'
import { GetContentsParam, GetChapterFindispayParam, PayBookChapterParam } from '@/types/toutiaoApi'

/**
 * 书籍是否有阅读
 * @param {number} novel_id 书id
 */
export const chapterrecores = (novel_id : number) => POST('/Novel/chapterrecores', { novel_id })

/**
 * 书籍详情页面信息
 * @param {number} novel_id 书id
 */
export const getNovelinfo = (novel_id : number) => POST('/Novel/novelinfo', { novel_id })

/**
 * 分页获取章节列表解锁情况
 */
export const getContents = (data : GetContentsParam) => POST('/NovelDetails/chapter_ispay', data)

/**
 * 当前章节付费情况
 */
 let findUrl
 // // #ifdef MP-WEIXIN
 // findUrl = 'wxchapter_findispay'
 // // #endif
 // // #ifndef MP-WEIXIN
 // findUrl = 'chapter_findispay'
 // // #endif
  findUrl = 'bakchapter_findispay'
export const getChapterFindispay = (data : GetChapterFindispayParam) => POST(`/NovelDetails/${findUrl}`, data)

/**
 * 书币支付解锁
 */
export const payBookChapter = (data : PayBookChapterParam) => POST('/NovelDetails/chapter_findunlock', data)